package com.un.ebs.order.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.net.URL;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.*;
import com.un.ebs.core.util.OSSUtil;
import com.un.ebs.order.enums.DeliverTypeEnum;
import com.un.ebs.order.enums.PaymentStatusEnum;
import com.un.ebs.product.enums.*;
import org.springframework.stereotype.Component;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 2
 * </p>
 *
 * @author liubo
 * @since 2020-03-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Component
@TableName("v_order_item_ext")
public class OrderItemExt extends Model<OrderItemExt> {

    private static final long serialVersionUID=1L;

    private String id;

    private String orderId;

    private String orderCode;

    private String skuId;

    private String name;

    private String nameAs;

    private String saleAttrDesc;

    private Double qty;

    private Double price;

    private Double skuPrice;

    private Boolean skuIsDelete;

    private Boolean isVirtual;

    private String spuId;

    private Date startTime;

    private Date endTime;

    private Boolean acceptStatus;

    private Date acceptTime;

    private String acceptUserId;

    private String acceptUserName;

    private Boolean deliverStatus;

    private Date deliverTime;

    private String deliverUserId;

    private String deliverUserName;

    private Integer deliverSort;

    private ProductUnitTypeEnum unitType;

    private ProductChargeTypeEnum chargeType;

    private String classId;

    private Double chargeMinMoney;

    private String className;

    private String classRootName;

    private String tenantId;

    @TableLogic
    private Boolean isDelete;

    private String providerEntId;

    private String custId;

    private String custName;

    private String linkman;

    private String linkmanPhone;

    private String linkmanAdd;

    private String defunctName;

    private String defunctId;

    private String defunctCode;

    private String defunctIdNumber;

    private String tombSkuNameAs;

    private Boolean workOrderSubmitStatus;

    private Boolean workOrderAcceptStatus;

    private Boolean workOrderCompleteStatus;

    private String skuCode;

    private Boolean sendNotifyStatus;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT)
    private String createAtName;

    private ProductPriceConfirmTypeEnum priceConfirmType;

    private Boolean isDeliverFlow;

    private Boolean isDeliverAuditStatus;

    private Boolean isMustDefunctByOrder;

    private Boolean isMustDefunctTombSkuByOrder;

    private String remark;

    private Date deliverStartTime;

    private Date saleStart;

    private Date saleEnd;

    private Date allowDeliverStart;

    private Date allowDeliverEnd;

    private Boolean isSkuSale;

    private Boolean isSpuSale;

    private String deliverReadyTime;

    private Boolean submitStatus;

    private Date submitTime;

    private String submitUserId;

    private String submitUserName;

    private Boolean cancelStatus;

    private Date cancelTime;

    private String cancelUserId;

    private String cancelUserName;

    private String cancelDesc;

    private PaymentStatusEnum paymentStatus;

    private ProductSkuResourceStatusEnum resourceStatus;

    private String resourceOrderItemId;

    private DeliverTypeEnum deliverType;

    private Long orderItemCode;

    private String skuItemId;

    private String skuItemSkuId;

    private String skuItemParentId;

    private String skuLogoImage;

    private String includeSkuId;

    private Double includeSkuPrice;

    private Integer includeSkuQty;

    private Integer buyMinQty;

    private Integer buyMaxQty;

    private ProductSaleTypeEnum saleType;

    private String parentSkuId;

    private String personnelId;

    private String personnelName;

    private int workOrderCount;

    private Double discountMoney;

    @Override
    protected Serializable pkVal() {
        return null;
    }

    public String getSkuLogoImage() {
        URL url = OSSUtil.getObjectUrl(this.skuLogoImage);
        if (url != null) {
            return url.toString();
        } else {
            return null;
        }
    }

}